home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD Exchange
/
CD Exchange - Volume 1.iso
/
utils
/
misc
/
ace
/
ace-2.0.lha
/
PRGS.lha
/
Turtle
/
tree.b
< prev
Wrap
Text File
|
1994-01-10
|
795b
|
60 lines
'...recursive binary tree using turtle graphics
#include <inputs.h>
sub tree(n)
if n<5 then exit sub
turnright 30
forward n
tree(n*.75)
back n
turnleft 60
forward n
tree(n*.75)
back n
turnright 30
end sub
sub usage
print "usage: tree <depth>"
end sub
if argcount<>1 then
ask.depth=-1
else
ask.depth=0
x$=arg$(1)
if x$="?" then
usage
input "enter depth: ",depth
else
depth=val(x$) '..get depth
end if
end if
screen 1,640,225,2,2
color 1,0
cls
locate 1,1
if ask.depth then
prints "enter depth: "
depth=inputs%
cls
locate 1,1
end if
prints "depth of tree is"
prints depth
penup
setxy 320,150
pendown
tree(depth)
locate 24,1
prints "press 'q' to quit..."
while ucase$(inkey$)<>"Q":wend
screen close 1